package com.zyt.service.impl;

import com.zyt.mapper.AnimeMapper;
import com.zyt.service.AnimeService;

import java.util.*;
import com.zyt.entity.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class AnimeServiceImpl implements AnimeService {
    @Autowired
    private AnimeMapper animeMapper;
    @Override
    @Transactional(readOnly = true)
    public List<Anime> selectAll() {
        return animeMapper.selectAll();
    }

    @Override
    @Transactional(readOnly = true)
    public Anime selectById(Integer id) {
        return animeMapper.selectById(id);
    }

    @Override
    public void deleteById(Integer id) {
        animeMapper.deleteById(id);
    }

    @Override
    public void deleteMany(Integer[] ids) {
        for(int i=0;i<=ids.length;i++){
            animeMapper.deleteById(ids[i]);
        }
    }
    @Override
    public void updateById(Anime anime) {
        animeMapper.updateById(anime);
    }

    @Override
    public void insertAnime(Anime anime) {
        animeMapper.insertAnime(anime);
    }
}
